/*
 * @lc app=leetcode.cn id=944 lang=javascript
 *
 * [944] 删列造序
 */

// @lc code=start
/**
 * @param {string[]} strs
 * @return {number}
 */
var minDeletionSize = function (strs) {
  let arr = []
  strs.forEach(str => {
    if (arr.length === 0) {
      arr.push(...str.split(''))
    } else {
      arr = arr.map((s, i) => s + str.charAt(i));
    }
  })
  return arr.filter(str => {
    const a = str.split('');
    for (let i = 1; i < a.length; i++) {
      if (a[i] < a[i - 1]) {
        return true;
      }
    }
    return false;
  }).length;
};
// @lc code=end
// minDeletionSize(["zyx", "wvu", "tsr"]);
